#ifndef	_GLOBALS_H_
#define _GLOBALS_H_

#include "common.h"
#include <cstddef> /* size_t */
#include <vector>
#include "ReferenceSequence.h"
#include <sys/types.h>
#include "types.h"
#include "Match.h"

#define	CHUNK_SIZE	65536


extern	ReferenceSequence *refSeq;
extern size_t minMatchLength;
extern int numOfFiles;
extern uint pageSize;
extern uint windowSize;
extern size_t maxThreads;

struct Name
{
	const char *name;
	off_t fromPos;
	vector<Match*> *matches;
    
	Name(const char *name_, off_t fromPos_) :
		name(name_),
		fromPos(fromPos_),
		matches(new vector<Match *>())
	{}

	~Name()
	{
		delete name;
		// TODO - should we delete each match?
		delete matches;
	}
};

struct Printable
{
	char *seqName;
	vector<Match*> matches;

    Printable(char *seqName_) :
    	seqName(seqName_),
    	matches() 
    {}
};

struct FileData
{
	int fd;
	char *fname;
	off_t size;
	size_t parsedChunks;
	size_t pagesNum;
	vector<Printable> results;
	
	FileData(int fd_, char *fname_, size_t size_) : 
		fd(fd_),
		fname(fname_),
		size(size_),
		parsedChunks(0),
		pagesNum((size / pageSize) + ((size % pageSize != 0) ? 1 : 0)),
		results()
	{}
};
//array of files data
extern FileData **files;


#endif /* _GLOBALS_H_ */
